

//获取当前城市
const getCurrentCityName = function(){
    return new Promise((resolve)=>{
        let myCity = new ImageBitmap.LocalCity();
        myCity.get((result)=>{
            let geoc = new ImageBitmap.Geocoder();
            geoc.getLocation(result.center,(rs)=>{
                //rs中携带着所有定位信息，这里只获取城市(city)和所在的区(district)
                let addComp = rs.addressComponents;
                let result = addComp.city + addComp.district;
                resolve(result);
            });
        },{enableHighAccuracy:true});
    });
}
export default getCurrentCityName;